var limsMaterialApply = Gikam.getPageObject({

    getEditListColumns: function () {
        return [{
            checkbox: true
        }, {index: true}, Gikam.status.getBpmnColumn(limsMaterialApply.workflow.dbTable), {
            field: 'applyCode',
            title: 'T_LIMS_MATERIAL_APPLY.APPLYCODE',
            type: 'link',
        }, {
            field: 'applyType',
            title: 'T_LIMS_MATERIAL_APPLY.APPLYTYPE',
            type: 'select',
            firstBlank: false,
            category: 'sys',
            param: {
                codeCategoryId: 'materialOutType'
            },
            validators: ['notEmpty'],
        }, {
            field: 'groupType',
            title: 'T_LIMS_MATERIAL_APPLY.GROUPTYPE',
            type: 'select',
            search: true,
            firstBlank: false,
            category: 'sys',
            param: {
                codeCategoryId: 'groupType'
            },
            validators: ['notEmpty'],
        }, {
            field: 'remark',
            title: 'T_LIMS_MATERIAL_APPLY.REMARK',
            validators: ['strLength[0,120]'],
            type: 'richText',
            editor: true,
            wdith: 160,
        }, {
            field: 'createdByName',
            title: 'T_LIMS_LOCATION_CHANGE.CREATEDBYNAME',
            width: 140
        }, {
            field: 'createdTime',
            type: 'dateTime',
            title: 'T_LIMS_LOCATION_CHANGE.CREATEDTIME',
            width: 160
        }]
    },

    getBaseInfoFormFields: function () {
        return [{
            field: 'applyType',
            title: 'T_LIMS_MATERIAL_APPLY.APPLYTYPE',
            validators: ['notEmpty', 'strLength[0,12]'],
            preInsert: true,
            type: 'select',
            firstBlank: false,
            category: 'sys',
            param: {
                codeCategoryId: 'materialOutType'
            },
        }, {
            field: 'groupType',
            title: 'T_LIMS_MATERIAL_APPLY.GROUPTYPE',
            validators: ['notEmpty', 'strLength[0,12]'],
            preInsert: true,
            type: 'select',
            search: true,
            firstBlank: false,
            category: 'sys',
            param: {
                codeCategoryId: 'groupType'
            },
        }, {
            field: 'remark',
            title: 'T_LIMS_MATERIAL_APPLY.REMARK',
            preInsert: true,
            validators: ['strLength[0,120]'],
            type: 'richText',
        },]
    },

    getAuditListColumns: function () {
        return [{
            checkbox: true
        }, {index: true}, Gikam.status.getBpmnColumn(limsMaterialApply.workflow.dbTable), {
            field: 'applyCode',
            title: 'T_LIMS_MATERIAL_APPLY.APPLYCODE',
            type: 'link',
        }, {
            field: 'applyType',
            title: 'T_LIMS_MATERIAL_APPLY.APPLYTYPE',
            type: 'select',
            firstBlank: false,
            category: 'sys',
            param: {
                codeCategoryId: 'materialOutType'
            },
        }, {
            field: 'groupType',
            title: 'T_LIMS_MATERIAL_APPLY.GROUPTYPE',
            type: 'select',
            search: true,
            firstBlank: false,
            category: 'sys',
            param: {
                codeCategoryId: 'groupType'
            },
        }, {
            field: 'remark',
            title: 'T_LIMS_MATERIAL_APPLY.REMARK',
            validators: ['strLength[0,120]'],
            type: 'richText',
            wdith: 160
        }, {
            field: 'createdByName',
            title: 'T_LIMS_LOCATION_CHANGE.CREATEDBYNAME',
            width: 140
        }, {
            field: 'createdTime',
            type: 'dateTime',
            title: 'T_LIMS_LOCATION_CHANGE.CREATEDTIME',
            width: 160
        }]
    },

    getSearchListColumns: function () {
        return [{
            checkbox: true
        }, {index: true}, Gikam.status.getBpmnColumn(limsMaterialApply.workflow.dbTable), {
            field: 'applyCode',
            title: 'T_LIMS_MATERIAL_APPLY.APPLYCODE'
        }, {
            field: 'applyType',
            title: 'T_LIMS_MATERIAL_APPLY.APPLYTYPE',
            type: 'select',
            firstBlank: false,
            category: 'sys',
            param: {
                codeCategoryId: 'materialOutType'
            },
        }, {
            field: 'groupType',
            title: 'T_LIMS_MATERIAL_APPLY.GROUPTYPE',
            type: 'select',
            search: true,
            firstBlank: false,
            category: 'sys',
            param: {
                codeCategoryId: 'groupType'
            },
        }, {
            field: 'remark',
            title: 'T_LIMS_MATERIAL_APPLY.REMARK',
            validators: ['strLength[0,120]'],
            type: 'richText',
            wdith: 160
        }, {
            field: 'createdByName',
            title: 'T_LIMS_LOCATION_CHANGE.CREATEDBYNAME',
            width: 140
        }, {
            field: 'createdTime',
            type: 'dateTime',
            title: 'T_LIMS_LOCATION_CHANGE.CREATEDTIME',
            width: 160
        }]
    },

    getChooseListColumns: function () {
        return [{index: true},{
            field: 'applyType',
            title: 'T_LIMS_MATERIAL_APPLY.APPLYTYPE'
        }, {
            field: 'groupType',
            title: 'T_LIMS_MATERIAL_APPLY.GROUPTYPE'
        }, {
            field: 'remark',
            type: 'richText',
            title: 'T_LIMS_MATERIAL_APPLY.REMARK'
        }, {
            field: 'applyCode',
            title: 'T_LIMS_MATERIAL_APPLY.APPLYCODE'
        },]
    },

    baseUrl: IFM_CONTEXT + '/secure/basemodule/rm/material-applys',

    workflow: {
        dbTable: 'T_LIMS_MATERIAL_APPLY',
        columns: [{
            field: 'id',
            title: 'T_LIMS_MATERIAL_APPLY.ID'
        }]
    },

    /**
     * 材料出库信息
     */
    getMaterialOutEditListColumns: function () {
        return [{
            checkbox: true
        }, {index: true}, {
            field: 'matCode',
            title: 'T_LIMS_MATERIAL_OUT.MATCODE'
        }, {
            field: 'matName',
            title: 'T_LIMS_MATERIAL_OUT.MATNAME'
        }, {
            field: 'matNum',
            title: 'T_LIMS_MATERIAL_OUT.MATNUM',
            readonly: true,
        }, {
            field: 'preOutNum',//申请数量
            title: 'T_LIMS_MATERIAL_OUT.PREOUTNUM',
            editor: true,
            width: 140,
            validators: ['notEmpty', 'integer', 'numRange(0,)'],
            onChange: function (field, value, index) {
                var num = this.options.data[index].matNum;
                if (parseFloat(value) > parseFloat(num)) {
                    Gikam.alert("出库数量超出库存总数")
                    return false
                }
                this.setData({
                    index: index,
                    preOutNum: value,
                    outNum: value // 出库数量默认和申请数量一致
                })
            }
        }, {
            field: 'plannedDeliveryTime',
            title: 'T_LIMS_MATERIAL_OUT.PLANNEDDELIVERYTIME',
            editor: true,
            type: 'dateTime',
            width: 140
        }, {
            field: 'purpose',
            title: 'T_LIMS_MATERIAL_OUT.PURPOSE',
            editor: true,
            type: 'select',
            search: true,
            firstBlank: false,
            category: 'sys',
            param: {
                codeCategoryId: 'purpose'
            },
        }, {
            field: 'remark',
            editor: true,
            title: 'T_LIMS_MATERIAL_OUT.REMARK'
        }]
    },

    getMaterialOutAuditListColumns: function (step) {
        let columns = [{
            checkbox: true
        }, {index: true}, {
            field: 'matCode',
            title: 'T_LIMS_MATERIAL_OUT.MATCODE'
        }, {
            field: 'matName',
            title: 'T_LIMS_MATERIAL_OUT.MATNAME'
        }, {
            field: 'matNum',
            title: 'T_LIMS_MATERIAL_OUT.MATNUM',
            readonly: true,
        }, {
            field: 'preOutNum',//申请数量
            title: 'T_LIMS_MATERIAL_OUT.PREOUTNUM',
            width: 140,
            validators: ['notEmpty', 'number', 'numRange(0,)'],
        }, {
            field: 'plannedDeliveryTime',
            title: 'T_LIMS_MATERIAL_OUT.PLANNEDDELIVERYTIME',
            type: 'dateTime',
            width: 140
        }, {
            field: 'purpose',
            title: 'T_LIMS_MATERIAL_OUT.PURPOSE',
            type: 'select',
            search: true,
            firstBlank: false,
            category: 'sys',
            param: {
                codeCategoryId: 'purpose'
            },
        }, {
            field: 'remark',
            title: 'T_LIMS_MATERIAL_OUT.REMARK'
        }, {
            field: 'reviewRemark',
            editor: step === 'audit',
            title: 'T_LIMS_MATERIAL_OUT.REVIEWREMARK'
        }];
        if (step === 'approve') {
            columns.splice(6, 0, {
                field: 'outNum',//出库数量
                title: 'T_LIMS_MATERIAL_OUT.OUTNUM',
                width: 140,
                validators: ['notEmpty', 'number', 'numRange(0,)'],
                editor: true
            })
        }
        return columns;
    },

    getMaterialOutSearchListColumns: function () {
        return [{
            checkbox: true
        }, {index: true}, {
            field: 'matCode',
            title: 'T_LIMS_MATERIAL_OUT.MATCODE'
        }, {
            field: 'matName',
            title: 'T_LIMS_MATERIAL_OUT.MATNAME'
        }, {
            field: 'matNum',
            title: 'T_LIMS_MATERIAL_OUT.MATNUM',
            readonly: true,
        }, {
            field: 'preOutNum',//申请数量
            title: 'T_LIMS_MATERIAL_OUT.PREOUTNUM',
            width: 140,
            validators: ['notEmpty', 'number', 'numRange(0,)'],
        }, {
            field: 'outNum',//出库数量
            title: 'T_LIMS_MATERIAL_OUT.OUTNUM',
            width: 140,
            validators: ['notEmpty', 'number', 'numRange(0,)'],
        }, {
            field: 'plannedDeliveryTime',
            title: 'T_LIMS_MATERIAL_OUT.PLANNEDDELIVERYTIME',
            type: 'dateTime',
            width: 140
        }, {
            field: 'purpose',
            title: 'T_LIMS_MATERIAL_OUT.PURPOSE',
            type: 'select',
            search: true,
            firstBlank: false,
            category: 'sys',
            param: {
                codeCategoryId: 'purpose'
            },
        }, {
            field: 'remark',
            title: 'T_LIMS_MATERIAL_OUT.REMARK'
        }, {
            field: 'reviewRemark',
            title: 'T_LIMS_MATERIAL_OUT.REVIEWREMARK'
        }]
    },

    /**
     * 审核记录
     */
    getFlowListColumns: function () {
        return [{
            index: true
        }, {
            title: 'CORE.MODULE.SYS.T_CORE_BPMN_DIAGRAM.CANDIDATOR.TASKNAME',
            field: 'taskName',
        }, {
            title: 'CORE.MODULE.SYS.T_CORE_BPMN_DIAGRAM.CANDIDATOR.USER',
            field: 'auditedByName'
        }, {
            title: 'T_CORE_INTERNAL_AUDIT.AUDITDATE',
            field: 'auditedTime',
            width: 140
        }, {
            title: 'GIKAM.WORKFLOW.PASS.OPINION.TITLE',
            field: 'comment',
            width: 300
        }, {
            title: 'CORE.MODULE.SYS.T_CORE_BPMN_DIAGRAM.COMMENT.ROUTE',
            field: 'route',
            width: 140
        }]
    },

    /**
     * 材料出库记录
     */
    getStandardInventoryEditListColumns: function () {
        return [{
            checkbox: true
        }, {
            index: true
        }, {
            field: 'storageNo',
            title: 'T_LIMS_STANDARD_INVENTORY.STORAGENO',
            validators: ['strLength[0,24]'],
            preInsert: true,
        }, {
            field: 'ext$.matexpired',
            title: 'T_LIMS_STANDARD_INVENTORY.EXPIRED',
            type: 'select',
            category: 'sys',
            param: {
                codeCategoryId: 'yesorno'
            },
            styleFormatter: function (row) {
                if (row.ext$.matexpired === '1') {
                    return {color: '#FF2D2D'}
                }
            }
        }, {
            field: 'supplier',
            title: 'T_LIMS_STANDARD_INVENTORY.SUPPLIER',
            validators: ['strLength[0,36]'],
        }, {
            field: 'operateTime',
            title: 'T_LIMS_STANDARD_INVENTORY.OPERATETIME',
            type: 'dateTime',
            width: 140
        }, {
            field: 'buyer',
            title: 'T_LIMS_STANDARD_INVENTORY.BUYER',
            validators: ['strLength[0,36]'],
        }, {
            field: 'storehouseManager',
            title: 'T_LIMS_STANDARD_INVENTORY.STOREHOUSEMANAGER',
            validators: ['strLength[0,36]'],
        }, {
            field: 'storageNum',
            title: 'T_LIMS_STANDARD_INVENTORY.STORAGENUM',
            validators: ['number'],
            onChange: function (field, value, index, oldValue, text) {
                this.setData({
                    batchNum: value
                })
            },
            preInsert: true,
        }, {
            field: 'batchNum',
            title: 'T_LIMS_STANDARD_INVENTORY.BATCHNUM',
            validators: ['number'],
            //preInsert : true,
        }, {
            field: 'storageBatch',
            title: 'T_LIMS_STANDARD_INVENTORY.STORAGEBATCH',
            validators: ['strLength[0,24]'],
        }, {
            field: 'warrantyExpiryDate',
            title: 'T_LIMS_STANDARD_INVENTORY.WARRANTYEXPIRYDATE',
            type: 'dateTime',
            width: 140
        }, {
            field: 'usefulTime',
            title: 'T_LIMS_STANDARD_INVENTORY.USEFULTIME',
            type: 'dateTime',
            width: 140
        }, {
            field: 'productionDate',
            title: 'T_LIMS_STANDARD_INVENTORY.PRODUCTIONDATE',
            type: 'dateTime',
            width: 140
        }, {
            field: 'storehouse',
            title: 'T_LIMS_STANDARD_INVENTORY.STOREHOUSE',
            validators: ['strLength[0,120]'],
        }, {
            field: 'storehouseLocation',
            title: 'T_LIMS_STANDARD_INVENTORY.STOREHOUSELOCATION',
            validators: ['strLength[0,120]'],
        }, {
            field: 'remark',
            title: 'T_LIMS_STANDARD_INVENTORY.REMARK',
            validators: ['strLength[0,150]'],
            preInsert: true,
        }]
    },

    getStandardInventoryOutFields: function (preInsert) {
        return [{
            field: 'outNum',
            title: 'T_LIMS_STANDARD_INVENTORY.OUTNUM',
            preInsert: true,
            validators: ['notEmpty', 'integer', 'numRange(0,)'],
        }]
    },

    /**
     * 材料库存历史记录
     */
    getStandardHistoryEditListColumns: function () {
        return [{
            checkbox: true
        }, {
            index: true
        }, {
            field: 'auditStatus',
            title: 'T_LIMS_STANDARD_HISTORY.AUDITSTATUS',
            width: 90
        }, {
            field: 'operation',
            title: 'T_LIMS_STANDARD_HISTORY.OPERATION',
            width: 110
        }, {
            field: 'issueType',
            title: 'T_LIMS_STANDARD_HISTORY.ISSUETYPE',
            type: 'select',
            firstBlank: false,
            category: 'sys',
            param: {
                codeCategoryId: 'materialOutType'
            },
            width: 90
        }, {
            field: 'quantity',
            title: 'T_LIMS_STANDARD_HISTORY.QUANTITY',
            readonly: true,
            width: 60
        }, {
            field: 'createdByName',
            title: 'T_LIMS_STANDARD_HISTORY.CREATEDBYNAME',
            readonly: true,
            width: 110
        }, {
            field: 'createdTime',
            title: 'T_LIMS_STANDARD_HISTORY.CREATEDTIME',
            readonly: true,
            width: 140
        }, {
            field: 'completeTime',
            title: 'T_LIMS_STANDARD_HISTORY.COMPLETETIME',
            type: 'dateTime',
            width: 140
        }, {
            field: 'createdByOrgName',
            title: 'T_LIMS_STANDARD_HISTORY.CREATEDBYORGNAME',
            readonly: true,
            width: 250
        }]
    },

    /**
     * 审核记录
     */
    getFlowListColumns: function () {
        return [{
            index: true
        }, {
            title: 'CORE.MODULE.SYS.T_CORE_BPMN_DIAGRAM.CANDIDATOR.TASKNAME',
            field: 'taskName',
        }, {
            title: 'CORE.MODULE.SYS.T_CORE_BPMN_DIAGRAM.CANDIDATOR.USER',
            field: 'auditedByName'
        }, {
            title: 'T_CORE_INTERNAL_AUDIT.AUDITDATE',
            field: 'auditedTime',
            width: 140
        }, {
            title: 'GIKAM.WORKFLOW.PASS.OPINION.TITLE',
            field: 'comment',
            width: 300
        }, {
            title: 'CORE.MODULE.SYS.T_CORE_BPMN_DIAGRAM.COMMENT.ROUTE',
            field: 'route',
            width: 140
        }]
    },

})
